Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Access
Imports dao

Public Class AccessQueryTransformer
    Inherits BaseAccessObjectTransformer

    Protected Overrides Sub Tranform()

        Dim qdefs As QueryDefs = _app.Application.CurrentDb.QueryDefs
        Console.WriteLine("Will export " & qdefs.Count & " " & Me.getAccessType.ToString)
        For Each q As QueryDef In qdefs
            If Not q.Name.StartsWith("~") Then
                _app.SaveAsText(AcObjectType.acQuery, q.Name, Me.getObjectFileName(q.Name))
                Me.addObjectName(New ExportedAccessObject(q.Name, _
                                     SVNAccessObjectType.acQuery))

            End If

        Next

    End Sub

    Public Overrides Function getSubfolder() As String
        Return "Queries"
    End Function

    Public Overrides Function getExtension() As String
        Return "ACQ"
    End Function

    Protected Overrides Function getAccessType() As Microsoft.Office.Interop.Access.AcObjectType
        Return AcObjectType.acQuery
    End Function

End Class
